//
//  ZXbaseView.m
//  MortgageHelper
//
//  Created by fly Mac on 16/7/8.
//  Copyright © 2016年 zhangxiang. All rights reserved.
//

#import "ZXbaseView.h"

@implementation ZXbaseView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

+(id)viewWithSelfNib
{
    return [[self class] viewWithNibName:NSStringFromClass([self class])];
}

+ (id)viewWithNibName:(NSString *)nibName
{
    UINib *nib = [UINib nibWithNibName:nibName bundle:nil];
    
    NSArray *nibObjects = [nib instantiateWithOwner:nil options:nil];
    UIView *view = nil;
    if (nibObjects && nibObjects.count >0 )
    {
        view = [nibObjects objectAtIndex:0];
    }
    
    if ([view isKindOfClass:[ZXbaseView class]])
    {
        [(ZXbaseView *)view customInit];
    }
    
    return view;
}

- (void)customInit
{
    
}

@end
